﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Xml;
public partial class HotelList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(HotelList), this);
    }

    [AjaxPro.AjaxMethod]
    public string SearchHotel(string cityCode, string checkInDate, string checkOutDate, string keyword, string star, int sort, int sortType, int pageIndex, int pageSize)
    {
        string rtn = string.Empty;
        try
        {
            int total = 0;
            string strWhere = string.Empty;
            if (!string.IsNullOrEmpty(keyword))
            {
                if (!string.IsNullOrEmpty(strWhere))
                    strWhere += " and ";
                strWhere += "chn_name like '%" + keyword + "%'";
            }

            string strOrder = Enum.GetName(typeof(EnumHelper.HotelSortEnum), sort) + " " + Enum.GetName(typeof(EnumHelper.SortType), sortType);
            DataSet ds = SearchAPI.SearchHotelList(cityCode, checkInDate, checkOutDate, strWhere, strOrder, pageIndex, pageSize, out total);
            if (ds != null)
                rtn = JsonHelper.ToJson(ds);
        }
        catch { }
        return rtn;
    }
}
